# 找到所有文素数
def is_prime_2(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def is_prime(n):
    if n == 2:
        return True
    if n % 2 == 0 or n<2:
        return False
    for i in range(3, int(n**0.5)+1, 2):
        if n % i == 0:
            return False
    return True

def is_palindrome(n):
    s = str(n)
    return s == s[::-1]


def main():
    for n in range(1, int(1e9)):
        if is_prime(n) and is_palindrome(n):
            print(n)


if __name__ == '__main__':
    main()
